<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改考核人员')" />
	<th:block th:include="include :: select2-css" />
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-record-edit" class="form-horizontal" th:object="${record}">
        <input name="recordId" id="recordId" type="hidden"  th:field="*{recordId}" />
        <input name="personnelCategory" id="personnelCategory" type="hidden"  th:field="*{personnelCategory}" />
        <h4 class="form-header h4">考核成绩记录</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">姓名：</label>
                    <div class="col-sm-8">
                        <input name="examPersonnel" id="examPersonnel" placeholder="请输入考核人姓名" class="form-control" th:field="*{examPersonnel}"
                               type="text" maxlength="30" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">出生日期：</label>
                        <div class="input-group date">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            <input type="text" id="birthday" name="birthday" placeholder="请选择出生日期" class="form-control" th:field="*{birthday}">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">年龄：</label>
                        <div class="col-sm-8">
                            <input name="age" id="age" placeholder="请输入考核人年龄" class="form-control" th:field="*{age}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">性别：</label>
                    <div class="col-sm-8">
                        <select name="gender" id="gender" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{gender}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">身高：</label>
                        <div class="col-sm-8">
                            <input name="height" id="height" placeholder="请输入考核人身高" class="form-control" th:field="*{height}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">体重：</label>
                        <div class="col-sm-8">
                            <input name="weight" id="weight" placeholder="请输入考核人体重" class="form-control" th:field="*{weight}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">体脂：</label>
                        <div class="col-sm-8">
                            <input name="bodyFat" id="bodyFat" placeholder="请输入考核人体脂" class="form-control" th:field="*{bodyFat}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">3000米跑(分)：</label>
                        <div class="col-sm-8">
                            <input name="threeKmMinute" id="threeKmMinute" placeholder="请输入考核人身高" class="form-control" th:field="*{threeKmMinute}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">3000米跑(秒)：</label>
                        <div class="col-sm-8">
                            <input name="threeKmSecond" id="threeKmSecond" placeholder="请输入考核人体重" class="form-control" th:field="*{threeKmSecond}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">考核项目：</label>
                        <div class="col-sm-8">
                            <input name="typeOfExam" id="typeOfExam" placeholder="请输入考核项目" class="form-control" th:field="*{typeOfExam}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">项目成绩：</label>
                        <div class="col-sm-8">
                            <input name="examScore" id="examScore" placeholder="请输入考核人体重" class="form-control" th:field="*{examScore}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">仰卧起坐：</label>
                        <div class="col-sm-8">
                            <input name="sitUp" id="sitUp" placeholder="请输入仰卧起坐成绩" class="form-control" th:field="*{sitUp}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">30米×2蛇形跑：</label>
                        <div class="col-sm-8">
                            <input name="snakeRun" id="snakeRun" placeholder="请输入蛇形跑成绩" class="form-control" th:field="*{snakeRun}" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
	<script type="text/javascript">
        var prefix = ctx + "examine/record";
        var prefix_validate = ctx + "examine/personnel";

        $("#form-record-edit").validate({
            onkeyup: false,
            rules:{
                examPersonnel:{
                    minlength: 2,
                    maxlength: 20,
                    remote: {
                        url: prefix_validate + "/checkPersonnelNameUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            "examPersonnel": function() {
                                return $.common.trim($("#examPersonnel").val());
                            }
                        },
                        dataFilter: function(data, type) {
                            return $.validate.unique(data);
                        }
                    }
                }
            },
            messages: {
                "examPersonnel": {
                    remote: "考核人员已经存在"
                }
            },
            focusCleanup: true
        });

        function submitHandler() {
            var recordId = $("#recordId").val();
            var personnelCategory = $("#personnelCategory").val();
            var examPersonnel = $("#examPersonnel").val();
            var birthday = $("#birthday").val();
            var age = $("#age").val();
            var gender = $("#gender").val() === "0" ? "男" : "女";
            var height = $("#height").val();
            var weight = $("#weight").val();
            var bodyFat = $("#bodyFat").val();
            var threeKmMinute = $("#threeKmMinute").val();
            var threeKmSecond = $("#threeKmSecond").val();
            var typeOfExam = $("#typeOfExam").val();
            var examScore = $("#examScore").val();
            var sitUp = $("#sitUp").val();
            var snakeRun = $("#snakeRun").val();

            var data = [];

            data.push({"name": "recordId", "value": recordId});
            data.push({"name": "personnelCategory", "value": personnelCategory});
            data.push({"name": "examPersonnel", "value": examPersonnel});
            data.push({"name": "birthday", "value": birthday});
            data.push({"name": "age", "value": age});
            data.push({"name": "gender", "value": gender});
            data.push({"name": "height", "value": height});
            data.push({"name": "weight", "value": weight});
            data.push({"name": "bodyFat", "value": bodyFat});
            data.push({"name": "threeKmMinute", "value": threeKmMinute});
            data.push({"name": "threeKmSecond", "value": threeKmSecond});
            data.push({"name": "typeOfExam", "value": typeOfExam});
            data.push({"name": "examScore", "value": examScore});
            data.push({"name": "sitUp", "value": sitUp});
            data.push({"name": "snakeRun", "value": snakeRun});
            $.operate.saveTab(prefix + "/edit", data);
        }


		function doSubmit(index, layero){
			var tree = layero.find("iframe")[0].contentWindow.$._tree;
   			var body = layer.getChildFrame('body', index);
   			$("#treeId").val(body.find('#treeId').val());
   			$("#treeName").val(body.find('#treeName').val());
   			layer.close(index);
		}

		$(function() {
		    // 6	黄平	1987年5月1日	33	男						俯卧撑				2021年3月	三类人员
            layui.use('laydate', function () {
                var laydate = layui.laydate;
                laydate.render({
                    elem: '#birthday'
                });
            });
        })
    </script>
</body>
</html>
